import request from '@/utils/request'

// 获取月卡信息列表
export const getCardListAPI = (params) => {
  return request({
    url: '/parking/card/list',
    method: 'GET',
    params
  })
}

// 添加月卡信息
export const addCardAPI = (data) => {
  return request({
    url: '/parking/card',
    method: 'POST',
    data
  })
}

// 编辑月卡信息（详情）
export const editCardAPI = (id) => {
  return request({
    url: `parking/card/${id}`,
    method: 'get'

  })
}

// 提交编辑信息
export const editCardSubmitAPI = (data) => {
  return request({
    url: '/parking/card/edit',
    method: 'PUT',
    data
  })
}

// 删除月卡信息
export const deleteCardAPI = (id) => {
  return request({
    url: `/parking/card/${id}`,
    method: 'DELETE'
  })
}

// 计费规则管理 ==========================

// 获取计费规则列表
export const getRuleListAPI = (params) => {
  return request({
    url: '/parking/rule/list',
    method: 'GET',
    params
  })
}

// 确认提交计费规则
export const addRuleAPI = (data) => {
  return request({
    url: '/parking/rule',
    method: 'POST',
    data
  })
}

// 删除计费规则
export const deleteRuleAPI = (id) => {
  return request({
    url: `/parking/rule/${id}`,
    method: 'DELETE'
  })
}

// 查看计费规则详情
export const getRuleDetailAPI = (id) => {
  return request({
    url: `/parking/rule/${id}`
  })
}
